package ioStream.file.processStream.byteStream;

import java.io.*;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-03-18
 * Time:15:52
 */
@SuppressWarnings("all")
public class BufferedCopy {
    public static void main(String[] args) {
        String srcFilePath = "C:\\Users\\22954\\Music\\船长 - 赵雷.flac";
        String desFilePath = "f:/Test/船长.flac";
        BufferedInputStream bi = null;
        BufferedOutputStream bo = null;
        try {
            bi = new BufferedInputStream(new FileInputStream(srcFilePath));
            bo = new BufferedOutputStream(new FileOutputStream(desFilePath));
            byte[] data = new byte[1024];
            int readlen = 0;
            while ((readlen = bi.read(data)) != -1){
                bo.write(data, 0, readlen);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                bi.close();
                bo.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
